package org.micode.libs.pay.wxpay.enums;

/**
 * 支持的支付类型
 */
public enum PayTypeEnum {

    /**
     * 1, "测试充值"
     */
    TEST(1, "Test recharge"),

    /**
     * 2, "微信二维码"
     */
    WEIXIN_QRCODE(2, "Wechat QR code"),

    /**
     * 3, "微信公众号, 小程序"
     */
    WEIXIN_JSAPI(3, "WeChat official account and applet"),
    ;

    private int code;
    private String name;

    PayTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getPayTypeName(int code) {
        for (PayTypeEnum type : PayTypeEnum.values()) {
            if (type.code == code) {
                return type.name;
            }
        }
        return "";
    }

    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }

}
